﻿Public Class HoSoXetNghiem

    Private Sub HoSoBenhNhan_Load(sender As Object, e As System.EventArgs) Handles Me.Load
        'TODO: This line of code loads data into the 'PCV_CLINICDataSet_Don.DMDichVu' table. You can move, or remove it, as needed.
        Me.DMDichVuTableAdapter.Fill(Me.PCV_CLINICDataSet_Don.DMDichVu)
        Me.TuNgayIDateEdit.EditValue = getNgayDauThang(Today())
        Me.DenNgayIDateEdit.EditValue = getNgayCuoiThang(Today())
    End Sub

    Private Sub BarButtonItemLamTuoi_ItemClick_1(sender As System.Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItemLamTuoi.ItemClick
        If IsNothing(Me.DichVuISearchLookupEdit.EditValue) Then
            DevExpress.XtraEditors.XtraMessageBox.Show("Xin vui lòng chọn loại dịch vụ", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information)
        Else
            Me.GetHoSoXetNghiemTableAdapter.Fill(Me.PCV_CLINICDataSetTongHop.getHoSoXetNghiem, CDate(Me.TuNgayIDateEdit.EditValue), CDate(DenNgayIDateEdit.EditValue), Me.DichVuISearchLookupEdit.EditValue.ToString)
        End If

    End Sub

    Private Sub BarButtonItemBaoCao_ItemClick(sender As System.Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItemBaoCao.ItemClick
        If IsNothing(Me.DichVuISearchLookupEdit.EditValue) Then
            DevExpress.XtraEditors.XtraMessageBox.Show("Xin vui lòng chọn 'Loại Bệnh Nhân' !", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information)
        Else
            Me.BarButtonItemLamTuoi.PerformClick()
            Dim report As Report_HoSoXetNghiem = New Report_HoSoXetNghiem
            report.GetHoSoXetNghiemTableAdapter1.Fill(Me.PCV_CLINICDataSetTongHop.getHoSoXetNghiem, CDate(Me.TuNgayIDateEdit.EditValue), CDate(Me.DenNgayIDateEdit.EditValue), Me.DichVuISearchLookupEdit.EditValue.ToString)
            report.TuNgay.Value = CDate(Me.TuNgayIDateEdit.EditValue)
            report.DenNgay.Value = CDate(Me.DenNgayIDateEdit.EditValue)
            report.LoaiDichVu.Value = Me.DichVuISearchLookupEdit.Properties.GetDisplayValueByKeyValue(Me.DichVuISearchLookupEdit.EditValue)
            report.ShowRibbonPreview()
        End If
    End Sub
End Class
